using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using MH.WsdlWorks.ProjectModel;

namespace MH.WsdlWorks
{
    [CLSCompliant(false), ComVisible(true)]
    public class RequestNodeProperties : SimpleNodeProperties
    {
        readonly Request request;

        public RequestNodeProperties(RequestNode requestNode)
            : base(requestNode)
        {
            request = requestNode.Request;
        }

        public override string GetClassName()
        {
            return "Request";
        }

        [Category("Misc")]
        [DisplayName("Service URL")]
        [Description("The web service URL for this request")]
        public string ServiceUrl
        {
            get
            {
                if (request.ServiceUrl == null)
                    return string.Empty;
                return request.ServiceUrl;
            }
            set
            {
                request.ServiceUrl = value;
            }
        }

        [Category("Misc")]
        [DisplayName("Request File")]
        [Description("This is the SOAP envelope used in the request")]
        public string RequestFile
        {
            get 
            {
                if (request.RequestFile == null)
                    return string.Empty;
                return request.RequestFile.Name; 
            }
        }

        [Category("Misc")]
        [DisplayName("Request File Path")]
        [Description("This is the path to the request file")]
        public string RequestFilePath
        {
            get
            {
                if (request.RequestFile == null)
                    return string.Empty;
                return request.RequestFile.GetPath();
            }
        }
    }
}
